#@layout()

#define main()
<div class="jfa-header-box" id="jfa-header-box">
	<div class="jfa-crumbs" id="jfa-crumbs">
		周转车信息
	</div>
	#include("/_view/common/_header_right.html")
</div>
<div class="jfa-content-box" id="jfa-content-box">
	<div class="jfa-content" id="jfa-content">
	    <div class="margin-top-30">
			<form class="form-horizontal actionPanel" action="#" method="get">
		        <div class="row">
		             <div class="form-group col-lg-3">
		                 <label class="col-sm-3 control-label">挂框</label>
		                 <div class="col-sm-9">
		                     <input type="text" id="form-rackNo" class="form-control" name="rackNo" value="">
		                 </div>
		             </div>
		             <div class="form-group col-lg-3">
		                 <label class="col-sm-4 control-label">跟踪号</label>
		                 <div class="col-sm-8">
		                     <input type="text" id="form-traceCode" class="form-control" name="traceNo" value="">
		                 </div>
		             </div>
		             <div class="form-group col-lg-4">
		                 <label class="col-sm-6 control-label">周转车编号</label>
		                 <div class="col-sm-6">
		                     <input type="text" id="form-vehicleCode" class="form-control" name="traceNo" value="">
		                 </div>
		             </div>
		             <div class="form-group col-lg-2">
                         <div class="col-sm-12">
                             <button type="button" class="btn btn-primary" onclick="searchVehicle()">查询</button>
                             <button type="reset" class="btn btn-default">重置</button>
                         </div>
                     </div>
		         </div>
		    </form>
		</div>
		

	###	<div id="toolbar" class="btn-group">
	###		<a class="btn btn-primary btn-sm margin-right-10" href="#(ctx)/admin/turnoverVehicle/add" >
	###			<i class="fa fa-plus"></i>
	###			添加周转车信息
	###		</a>
	### </div>
	    
		<table id="turnoverVehicle">
		</table>
	</div>
</div>
<script type="text/javascript">
 	var datagridHeight=$("#jfa-content").height()-80;
 	$('#turnoverVehicle').bootstrapTable({
        url: '#(ctx)/admin/turnoverVehicle/list',         
        method: 'get',
        toolbar: '#toolbar',
        striped: true,
        cache: false,
        pagination: true,
        sortable: false,                    
        sortOrder: "asc",  
        queryParams: function (params) {
	            var data = { 
	                    pageSize: params.limit,
	                    offset: params.offset,
	                    'rackNo': $("#form-rackNo").val(),
	                    'traceCode': $("#form-traceCode").val(),
					    'vehicleNo': $("#form-vehicleCode").val()
	            };
	            return data;
        },
        sidePagination: "server",
        pageNumber:1,
        toolbarAlign:"right",
        pageSize:210,         
        pageList: [210, 420,100],
        search: false,
        strictSearch: true,
        showColumns: false,
        showRefresh: false,             
        minimumCountColumns: 2,
        clickToSelect: true,               
       	height: datagridHeight,
        uniqueId: "id",
        showToggle:false,
        cardView: false,
        detailView: false,
        columns: [
            {
                field: 'hanger_no',  title: '挂具编号'
            }, {
                field: 'frame_no',  title: '电泳框编号'
            }, {
                field: 'material_no',  title: '物料编号'
            }, {
                field: 'barcode',  title: '条码号'
            }, {
                field: 'trace_no',  title: '跟踪号'
            }, {
                field: 'material_count',  title: '物料数量'
            },{
                field: 'vehicle_no',  title: '周转车编号',formatter:vehicleNoFormatter
            },{
            	field: 'status',  title: '状态'
            },{
                title: '操作',formatter:operaterFormatter
            }
        ]
    });

function vehicleNoFormatter(value,row,index) {
    if(value!=null && value !=""){
		var str = value.substr(5);
		return str;
	}else{
        return "";
	}
}
function operaterFormatter(value, row, index){
	/*
	if(row.print_flag==0){
		return "<a href='#(ctx)/admin/turnoverVehicle/edit?id="+row.id+"'>"+
		"<i class='fa fa-pencil' title='修改'></i>"+
		" </a> &nbsp"+
		"<a data-pjax href=\"#(ctx)/admin/turnoverVehicle/print?id="+row.id+"\">"+
		"	<i class='fa fa-print' title='打印'></i>"+
		"</a> &nbsp"+
		"<a  href='#' onclick='deleteVehicle(\""+row.id+"\")'>"+
		"	<i class='fa fa-trash' title='删除'></i>"+
		"</a>"
	}else{
		return "<a href='#(ctx)/admin/turnoverVehicle/edit?id="+row.id+"'>"+
		"<i class='fa fa-pencil' title='修改'></i>"+
		" </a> &nbsp"+
		"<a  href='#' onclick='deleteVehicle(\""+row.id+"\")'>"+
		"	<i class='fa fa-trash' title='删除'></i>"+
		"</a>"
	}
	*/
	if(row.print_flag==0){
		return "<a data-pjax href=\"#(ctx)/admin/turnoverVehicle/print?id="+row.id+"\">"+
		"	<i class='fa fa-print' title='打印'></i></a>"+
            "&nbsp;" +
            "<a  href='#(ctx)/admin/turnoverVehicle/locationDetailPage?barcode="+row.barcode+"'>"+
            "	<i class='fa fa-eye' title='详情'></i>"+
            "</a>"
	}else{
		return "已打印"
	}
}



function searchVehicle(){
	$('#turnoverVehicle').bootstrapTable("refresh",{silent: true});
    layer.msg('操作成功');
}

function deleteVehicle(id){
	layer.confirm("确认删除该记录？", {
		icon: 0
		, title:'' 
		, shade: 0.4
		, offset: "139px"
	}, function(index) { 
		$.ajax({
			url:"#(ctx)/admin/turnoverVehicle/delete",
			data:{"id":id},
			dataType:"json",
			success:function(ret){
				$('#turnoverVehicle').bootstrapTable("refresh",{silent: true});
			    layer.msg(ret.msg);
			    layer.close(index);   
			},
			error:function(){
				layer.close(index);   
			}
		});                           
		                       
	});
}

</script>
#end
